package com.qingke.listener;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * Application Lifecycle Listener implementation class TestHttpSessionListener
 *
 */
@WebListener
public class TestHttpSessionListener implements HttpSessionListener {

    /**
     * Default constructor. 
     */
    public TestHttpSessionListener() {
    	
    }

	/**
     * @see HttpSessionListener#sessionCreated(HttpSessionEvent)
     */
    public void sessionCreated(HttpSessionEvent arg0)  { 
    	String sessionId=arg0.getSession().getId();
    	long create=arg0.getSession().getCreationTime();
    	System.out.println("create>id:"+sessionId+",time:"+create);
    }

	/**
     * @see HttpSessionListener#sessionDestroyed(HttpSessionEvent)
     */
    public void sessionDestroyed(HttpSessionEvent arg0)  { 
    	String sessionId=arg0.getSession().getId();
    	System.out.println("destroy>id:"+sessionId);
    }
	
}
